{% extends "base_generic.html" %}

{% block content %}
  <div class="card" style="max-width: 500px; margin: 50px auto;">
    <h1>续借图书：{{bookinst.book.title}}</h1>
    <p>借阅者：{{bookinst.borrower}}</p>
    <p{% if bookinst.is_overdue %} class="text-danger"{% endif %}>应归还日期：{{bookinst.due_back}}</p>

    <form action="" method="post">
      {% csrf_token %}
      <div class="form-group">
        <label for="{{ form.renewal_date.id_for_label }}">新归还日期:</label>
        {{ form.renewal_date.as_widget(attrs={'class': 'form-control'}) }}
        {% if form.renewal_date.errors %}
          {% for error in form.renewal_date.errors %}
            <p class="text-danger">{{ error }}</p>
          {% endfor %}
        {% endif %}
      </div>
      <button type="submit" class="btn btn-primary btn-block">提交续借</button>
    </form>
  </div>
{% endblock %}
